﻿using Entity;
using Global.ExtensionMethods;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbFactory
{
    internal class UserFactory: BaseFactory<User>   
    {
        static internal User ls, fg, xj, wjk, fwx, badContact, anonymous;
        internal static void Create()
        {
            ls = register(new User
            {
                LogonName = "ls",
                Contact = new Contact
                {
                    QQ = "1402573345"
                }
            });
            fg = register(new User
            {
                LogonName = "fg",
                Contact = new Contact
                {
                    QQ = "2282636022"
                }
            });
            xj = register(new User
            {
                LogonName = "xj"
            });
            anonymous = register(new User());
        }

        private static User register(User user)
        {
            user.Password = "123456".Md5Encypt();
            user.Register();
            return Save(user);
        }
    }
}
